﻿using Microsoft.AspNetCore.Builder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DotNetCoreApi.Expand.ExecutionTime
{
    /// <summary>
    /// IApplicationBuilder扩展类
    /// </summary>
    public static class ExecutionTimeExpand
    {
        /// <summary>
        /// 注册执行时间中间件
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>

        public static IApplicationBuilder UseExecutionTime(this IApplicationBuilder app)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            return app.UseMiddleware<ExecutionTime>();
        }
    }

}
